/**
 * @param {string} s
 * @return {boolean}
 */
var isPalindrome = function (s) {
  let start = 0;
  let end = s.length - 1;
  let a, b;
  while (start < end) {
    while (start < end) {
      a = s.charCodeAt(start);
      if ((a >= 48 && a <= 57) || (a <= 122 && a >= 97)) {
        break;
      }
      if (a <= 90 && a >= 65) {
        a += 32;
        break;
      }
      start++;
    }
    if (start == end) {
      break;
    }
    while (start < end) {
      b = s.charCodeAt(end);
      if ((b >= 48 && b <= 57) || (b <= 122 && b >= 97)) {
        break;
      }
      if (b <= 90 && b >= 65) {
        b += 32;
        break;
      }
      end--;
    }
    if (start == end) {
      break;
    }
    if (a !== b) {
      return false;
    }
    start++;
    end--;
  }
  return true;
};
